package com.gitee.zycra.future.job.web.controller;

import com.gitee.zycra.future.job.common.bo.CommonResult;
import com.gitee.zycra.future.job.common.bo.PageQuery;
import com.gitee.zycra.future.job.common.param.PageQueryRunningParam;
import com.gitee.zycra.future.job.common.vo.JobRunningVO;
import com.gitee.zycra.future.job.service.JobScheduleLogService;
import com.gitee.zycra.future.job.web.annotation.AuthCheck;
import com.gitee.zycra.jdbc.model.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zycra
 */
@Slf4j
@RestController
@RequestMapping("/schedule/log")
public class JobScheduleLogController {

    @Autowired
    private JobScheduleLogService jobScheduleLogService;

    /**
     * 查询
     *
     * @param pageQuery 查询参数
     * @return 查询结果
     */
    @AuthCheck({"4", "5", "6", "7"})
    @PostMapping("/pageList")
    public CommonResult<PageResult<JobRunningVO>> pageList(@RequestBody @Validated PageQuery<PageQueryRunningParam> pageQuery) {
        PageResult<JobRunningVO> pageResult = jobScheduleLogService.selectJobScheduleLog(pageQuery);
        return CommonResult.success(pageResult);
    }
}
